﻿namespace FrameworkCore.Events;

/// <summary>
/// 事件发布者扩展类
/// </summary>
public static class EventPublisherExtensions
{
    /// <summary>
    /// 发布事件
    /// </summary>
    /// <typeparam name="T">实体类型</typeparam>
    /// <param name="eventPublisher">事件发布者</param>
    /// <param name="entity">实体</param>
    public static void Event<T>(this IEventPublisher eventPublisher, T entity) where T : class
    {
        eventPublisher.Publish(new Event<T>(entity));
    }
}